/**
 * 
 */
package com.star.mina;

import org.apache.mina.api.AbstractIoHandler;
import org.apache.mina.api.IdleStatus;
import org.apache.mina.api.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName: MyHandler
 * @Description: TODO
 * @author starhq
 * @createtime 2014年12月6日 下午2:24:53
 * @email : jian.wang@shinsoft.net
 * @modify by TODO
 * @resaon
 * @edittime
 * @version 1.0
 * @copyright shinsoft
 */
@Component("myHandler")
public class MyHandler extends AbstractIoHandler {

	@Autowired
	private MinaClient client;

	private static final Logger LOG = LoggerFactory.getLogger(MyHandler.class);

	@Override
	public void sessionOpened(IoSession session) {
		LOG.debug("session opened {}", session);
		session.getConfig().setIdleTimeInMillis(IdleStatus.WRITE_IDLE, 10);
	}

	@Override
	public void sessionClosed(IoSession session) {
		LOG.debug("session closed {}", session);
	}

	@Override
	public void messageSent(IoSession session, Object message) {
		LOG.debug("message sent {}", message);
	}

	@Override
	public void messageReceived(IoSession session, Object message) {
		LOG.debug("message received {}", message);
	}

}
